import {
    AutoComplete,
    Checkbox,
    Radio,
    Input,
    Cascader,
    DatePicker,
    InputNumber,
    Switch,
    Slider,
    Select,
    TreeSelect,
    Transfer,
    TimePicker
} from 'antd';
import CustomDatePicker from '@/components/Custom/CustomDatePicker';
import FileUpload from '@/components/Custom/FileUpload';
import LeaveType from '@/components/Custom/LeaveType';
import Transportation from '@/components/Custom/Transportation';
import CascaderSelect from '@/components/Custom/Cascader';
import CascaderLoad from '@/components/CascaderLoad';
import Editor from '@/components/Custom/Editor';
import TagList from '@/components/Custom/TagList';
import DemandDepartmentNum from '@/components/Custom/DemandDepartmentNum';
import Dimension from '@/components/Custom/Dimension';
import TableDiff from '@/components/Custom/TableDiff';
import PostTableDiff from '@/components/Custom/PostTableDiff';
import SalaryRefTable from '@/components/SalaryRefTable';

export default function getComponent(type) {
    let Component = null;
    if (type.startsWith('antd.')) {
        const componentName = type.replace('antd.', '');
        switch (componentName) {
            case 'AutoComplete':
                Component = AutoComplete;
                break;
            case 'Radio.Group':
                Component = Radio.Group;
                break;
            case 'Checkbox':
                Component = Checkbox;
                break;
            case 'Checkbox.Group':
                Component = Checkbox.Group;
                break;
            case 'Radio':
                Component = Radio;
                break;
            case 'Input':
                Component = Input;
                break;
            case 'Input.TextArea':
                Component = Input.TextArea;
                break;
            case 'Cascader':
                Component = Cascader;
                break;
            case 'DatePicker':
                Component = DatePicker;
                break;
            case 'DatePicker.MonthPicker':
                Component = DatePicker.MonthPicker;
                break;
            case 'DatePicker.WeekPicker':
                Component = DatePicker.WeekPicker;
                break;
            case 'DatePicker.RangePicker':
                Component = DatePicker.RangePicker;
                break;
            case 'InputNumber':
                Component = InputNumber;
                break;
            case 'Switch':
                Component = Switch;
                break;
            case 'Slider':
                Component = Slider;
                break;
            case 'Select':
                Component = Select;
                break;
            case 'TreeSelect':
                Component = TreeSelect;
                break;
            case 'Transfer':
                Component = Transfer;
                break;
            case 'TimePicker':
                Component = TimePicker;
                break;
            default:
                Component = null;
        }
    } else if (type.startsWith('custom.')) {
        const componentName = type.replace('custom.', '');
        switch (componentName) {
            case 'SalaryRefTable':
                Component = SalaryRefTable;
                break;
            case 'CustomDatePicker':
                Component = CustomDatePicker;
                break;
            case 'FileUpload':
                Component = FileUpload;
                break;
            case 'LeaveType':
                Component = LeaveType;
                break;
            case 'Transportation':
                Component = Transportation;
                break;
            case 'Cascader':
                Component = CascaderSelect;
                break;
            case 'CascaderLoad':
                Component = CascaderLoad;
                break;
            case 'Editor':
                Component = Editor;
                break;
            case 'TagList':
                Component = TagList;
                break;
            case 'DemandDepartmentId':
                Component = DemandDepartmentNum;
                break;
            case 'Dimension':
                Component = Dimension;
                break;
            case 'TableDiff':
                Component = TableDiff;
                break;
            case 'PostTableDiff':
                Component = PostTableDiff;
                break;
            default:
                Component = null;
        }
    }

    return Component;
}
